# load packages
import numpy as np
import pandas as pd; pd.set_option('display.max_rows', 1000); pd.set_option('display.max_columns', 500)
import matplotlib.pyplot as plt
import seaborn as sns; sns.set(color_codes=True)
import pickle
import geopandas as gpd # http://geopandas.org/gallery/plotting_basemap_background.html#sphx-glr-gallery-plotting-basemap-background-py
import contextily as ctx
import shapely.wkt # https://stackoverflow.com/questions/51855917/shapely-polygon-from-string
from shapely.geometry import Point, LineString, MultiLineString, Polygon
from shapely.ops import cascaded_union
df_col = pd.read_csv('data/NYPD_Motor_Vehicle_Collisions_-_Crashes.zip')
# make column names lower-case
df_col.rename(columns={c:c.lower() for c in df_col.columns}, inplace=True)
# convert data type
df_col['location'] = df_col['location'].apply(lambda x: shapely.wkt.loads(x) if not pd.isnull(x) else np.nan)
# correct wrong data
df_col.loc[
((40.489 > df_col['latitude']) | (df_col['latitude'] > 40.924) | # NYC boundary
(-74.272 > df_col['longitude']) | (df_col['longitude'] > -73.689)) # NYC boundary
, ['latitude','longitude','location']
] = np.nan
# functions
def Plot_Injuries_vs_Year(df_col, col='road_type', hue='is_bike', injured_killed='injured'):
pp = df_col.groupby(list(set([c for c in ['year',col,hue] if pd.notnull(c)]))).sum().reset_index(drop=False)
pp = pp.loc[(pp['year'] >= 2013) & (pp['year'] <= 2018)] # only year = [2013,2014,2015,2016,2017,2018]
if pd.notnull(col) & pd.notnull(hue):
sns.lmplot(x='year', y="number of persons "+injured_killed, col=col, hue=hue, data=pp, col_wrap=10, aspect=0.5) # https://seaborn.pydata.org/tutorial/regression.html
sns.lmplot(x='year', y="number of motorist "+injured_killed, col=col, hue=hue, data=pp, col_wrap=10, aspect=0.5) # https://seaborn.pydata.org/tutorial/regression.html
sns.lmplot(x='year', y="number of pedestrians "+injured_killed, col=col, hue=hue, data=pp, col_wrap=10, aspect=0.5) # https://seaborn.pydata.org/tutorial/regression.html
sns.lmplot(x='year', y="number of cyclist "+injured_killed, col=col, hue=hue, data=pp, col_wrap=10, aspect=0.5) # https://seaborn.pydata.org/tutorial/regression.html
else:
pp = pd.melt(pp,
id_vars=['year'],
value_vars=['number of persons '+injured_killed,'number of motorist '+injured_killed,'number of pedestrians '+injured_killed,'number of cyclist '+injured_killed],
var_name='type',
value_name='number of '+injured_killed)
sns.lmplot(x='year', y="number of "+injured_killed, hue='type', data=pp, aspect=1.2) # https://seaborn.pydata.org/tutorial/regression.html
plt.show()
def Plot_Geoms_On_NYCMap(geoms, ON_MAP=True):
#ref) https://towardsdatascience.com/geopandas-101-plot-any-data-with-a-latitude-and-longitude-on-a-map-98e01944b972
# df = gpd.GeoDataFrame(geometry=df_col['location'].dropna().loc[1:1000], crs={'init':'epsg:4326'})
df = gpd.GeoDataFrame(geometry=geoms, crs={'init':'epsg:4326'})
df = df.to_crs(epsg=3857) # convert data to the same CRS to combine our polygons and background tiles in the same map
# NYC borough boundaries
#ref) http://geopandas.org/gallery/plotting_basemap_background.html#sphx-glr-gallery-plotting-basemap-background-py
df_nyc = gpd.read_file(gpd.datasets.get_path('nybb')) # NYC borough boundary data that is available in geopandas datasets
df_nyc = df_nyc.to_crs(epsg=3857) # convert data to the same CRS to combine our polygons and background tiles in the same map
#--- plot --------------------
fig, ax = plt.subplots(figsize=(15,15))
df_nyc.plot(ax=ax, color='none', edgecolor='b', alpha=1.0, linewidth=1.5) # NYC borough boundaries
df.plot(ax=ax, color='r', edgecolor='r', alpha=0.2, markersize=1)
if ON_MAP:
# ctx.add_basemap(ax)
# ctx.add_basemap(ax, zoom=12)
ctx.add_basemap(ax, url=ctx.providers.Stamen.TonerLite)
ax.set_axis_off()
# Plot_Geoms_On_NYCMap(df_col.loc[df_col['on street name'].isnull(),'location'].dropna())
#-------------------------------------------------------------------------------
# from nltk.metrics.distance import edit_distance
# # http://maf.directory/zp4/abbrev.html
# word = 'lane'
# ww = pd.DataFrame({'word':aa, 'count':0}).groupby('word').count().reset_index().sort_values(by='count', ascending=False)
# ww['ii'] = ww['word'].apply(lambda w: word[0] != w[0])
# ww['ss'] = ww['word'].apply(lambda w: edit_distance(word, w, transpositions = True))
# ww.sort_values(by=['ii','ss'])
def find_road_type(streetname):
if len(set(streetname.lower().split()).intersection(['expressway','expressay','expresswaay','expresway','exressway','express','expway','expwy','expre','exway','expy','exwy','exwpy','exp','exp.'])) > 0:
return 'expressway'
elif len(set(streetname.lower().split()).intersection(['parkway','parrkway','parlway','parkwway','parkwayy','parkwary','prkwy','pkwy'])) > 0:
return 'parkway'
# elif len(set(streetname.lower().split()).intersection(['highway','hwy'])) > 0:
# return 'highway'
elif len(set(streetname.lower().split()).intersection(['drive','dr'])) > 0:
return 'drive'
# elif ((len(set(streetname.lower().split()).intersection(['drive','dr'])) > 0) &
# (len(set(streetname.lower().split()).intersection(['fdr'])) == 0)):
# return 'drive'
# elif len(set(streetname.lower().split()).intersection(['fdr'])) > 0:
# return 'fdr drive'
# elif len(set(streetname.lower().split()).intersection(['broadway'])) > 0:
# return 'broadway'
# elif len(set(streetname.lower().split()).intersection(['turnpike','tpke'])) > 0:
# return 'turnpike'
# elif len(set(streetname.lower().split()).intersection(['thruway','thruwy','thurway','throughway'])) > 0:
# return 'thruway'
# elif len(set(streetname.lower().split()).intersection(['concourse','concours'])) > 0:
# return 'concourse'
elif len(set(streetname.lower().split()).intersection(['bridge','bridge/','bridge,','bridgte','brdg','brg'])) > 0:
return 'bridge'
elif len(set(streetname.lower().split()).intersection(['street','st','st.'])) > 0:
return 'street'
# elif len(set(streetname.lower().split()).intersection(['boulevard','blvd'])) > 0:
# return 'boulevard'
elif len(set(streetname.lower().split()).intersection(['avenue','ave'])) > 0:
return 'avenue'
elif len(set(streetname.lower().split()).intersection(['road','rd'])) > 0:
return 'road'
else:
return 'others'
def count_by_year_borough(df, col1 = None, col2 = None, injured_killed='injured'):
#df1 = df.loc[(df['year'] >=2012) & (df['year'] <= 2015)]
#df2 = df.loc[(df['year'] >=2016) & (df['year'] <= 2019)]
if pd.notnull(col1) & pd.notnull(col2):
#tab1 = df1.groupby([col1, col2])['number of persons ' + injured_killed, 'number of pedestrians ' + injured_killed,'number of cyclist ' + injured_killed, 'number of motorist ' + injured_killed].sum()
#tab2 = df2.groupby([col1, col2])['number of persons ' + injured_killed, 'number of pedestrians ' + injured_killed,'number of cyclist ' + injured_killed, 'number of motorist ' + injured_killed].sum()
#return(tab1, tab2)
return(df.groupby([col1, col2])['number of persons ' + injured_killed, 'number of pedestrians ' + injured_killed,'number of cyclist ' + injured_killed, 'number of motorist ' + injured_killed].sum())
else:
#tab1 = df1.groupby(['year', 'borough'])['number of pedestrians ' + injured_killed,'number of cyclist ' + injured_killed, 'number of motorist ' + injured_killed].sum()
#tab2 = df2.groupby(['year', 'borough'])['number of pedestrians ' + injured_killed,'number of cyclist ' + injured_killed, 'number of motorist ' + injured_killed].sum()
#return(tab1, tab2)
return(df.groupby(['year', 'borough'])['number of pedestrians ' + injured_killed,'number of cyclist ' + injured_killed, 'number of motorist ' + injured_killed].sum())
def pivot_table(df, injured_killed = 'injured',index= 'borough'):
tab = pd.pivot_table(test, values=['number of persons ' + injured_killed,'number of pedestrians ' + injured_killed, 'number of cyclist ' + injured_killed,'number of motorist ' + injured_killed], index=[index], aggfunc=np.sum)
return(tab)
# impute data : borough, zip code, on street name
def Load_New_Data_From_OpenStreetMap():
zz = []
for n in range(0,35):
print(n)
zz.append(pd.read_pickle('data/openstreetmap/geopy_(%s).pickle'%n))
zz = pd.concat(zz, axis=0).reset_index(drop=True)
print(zz.shape)
zz = zz.drop_duplicates(subset='unique id')
print(zz.shape)
print(zz.info())
zz.head()
aa = zz['geopy'].apply(lambda x: x['address']['county'].upper()).map({
'NEW YORK COUNTY':'MANHATTAN',
'BRONX COUNTY':'BRONX',
'QUEENS COUNTY':'QUEENS',
'KINGS COUNTY':'BROOKLYN',
'RICHMOND COUNTY':'STATEN ISLAND'})
bb = zz['geopy'].apply(lambda x: x['address']['postcode'][0:5].replace('1122O','11220')
if 'postcode' in x['address'].keys() else np.nan).apply(lambda y: int(y) if (y not in ['(718)','NY 11','NY 10']) & (not pd.isnull(y)) else np.nan)
cc = zz['geopy'].apply(lambda x: x['address']['road'].upper()
if 'road' in x['address'].keys() else np.nan)
zz.loc[zz['borough'].isnull(),'borough'] = aa[zz['borough'].isnull()]
zz.loc[zz['zip code'].isnull(),'zip code'] = bb[zz['zip code'].isnull()]
zz.loc[zz['on street name'].isnull(),'on street name'] = cc[zz['on street name'].isnull()]
print(zz.info())
zz.head()
return zz
zz = Load_New_Data_From_OpenStreetMap()
df_col.set_index('unique id', inplace=True)
df_col.loc[zz['unique id'],['borough','zip code','on street name']] = zz[['unique id','borough','zip code','on street name']].set_index('unique id')
df_col.reset_index(inplace=True)
print(df_col.shape)
print(df_col.info())
df_col.head()
# create new columns
df_col['date_time'] = pd.to_datetime(df_col['date'] + ' ' + df_col['time'], format= '%m/%d/%Y %H:%M')
df_col['year'] = df_col['date_time'].dt.year
df_col['month'] = df_col['date_time'].dt.month
df_col['dayofweek'] = df_col['date_time'].dt.dayofweek
df_col['hour'] = df_col['date_time'].dt.hour
df_col['is_borough_null'] = df_col['borough'].isnull()
df_col['borough'].fillna('N/A', inplace = True)
df_col['is_location_null'] = df_col['location'].isnull()
df_col['road_type'] = df_col['on street name'].apply(lambda x: find_road_type(x) if not pd.isnull(x) else 'N/A')
df_col['is_expressway'] = df_col['road_type'].apply(lambda x: x in ['bridge', 'drive', 'expressway', 'parkway'])
Assumption 1: in order for an accident to be categorized as a KSI, pedesrtains or cyclist must collide with a car.
# KSI
# 'Pedestrian/Bicyclist/Other Pedestrian Error/Confusion'
#list(df_col['contributing factor vehicle 1'])
# 'number of motorist killed', 'number of motorist injured'
print("number of KSI killed :", df_col.loc[df_col['contributing factor vehicle 1'] == 'Pedestrian/Bicyclist/Other Pedestrian Error/Confusion']['number of persons killed'].sum()
)
print("number of KSI injured :", df_col.loc[df_col['contributing factor vehicle 1'] == 'Pedestrian/Bicyclist/Other Pedestrian Error/Confusion']['number of persons injured'].sum()
)
# df_col['ksi'] = df_col.loc[df_col['contributing factor vehicle 1'] == 'Pedestrian/Bicyclist/Other Pedestrian Error/Confusion']
df_ksi = df_col.loc[df_col['contributing factor vehicle 1'] == 'Pedestrian/Bicyclist/Other Pedestrian Error/Confusion']
#df_ksi.head(3)
Plot_Injuries_vs_Year(df_ksi, col=None, hue=None, injured_killed='injured')
Plot_Injuries_vs_Year(df_ksi, col=None, hue=None, injured_killed='killed')
a = count_by_year_borough(df_ksi, col1='year',col2= 'borough',injured_killed= 'injured')
a.sort_values(by = 'number of persons injured', ascending = False)
count_by_year_borough(df_ksi, col1='year',col2= 'road_type',injured_killed= 'injured')
Plot_Injuries_vs_Year(df_ksi, col='road_type', hue='road_type', injured_killed='injured')
count_by_year_borough(df_ksi, injured_killed= 'injured')
Plot_Injuries_vs_Year(df_ksi, col='borough', hue='borough', injured_killed='injured')
count_by_year_borough(df_ksi, col1 = 'year', col2= 'road_type', injured_killed= 'killed')
Plot_Injuries_vs_Year(df_ksi, col='road_type', hue='road_type', injured_killed='killed')
count_by_year_borough(df_ksi, injured_killed= 'killed')
Plot_Injuries_vs_Year(df_ksi, col='borough', hue='borough', injured_killed='killed')
a = pivot_table(df_ksi, injured_killed= "killed", index='borough')
a.sort_values(by = 'number of persons killed', ascending = False)
a = pivot_table(df_ksi, injured_killed= "injured", index='borough')
a.sort_values(by = 'number of persons injured', ascending = False)
a = pivot_table(df_ksi, injured_killed= "injured", index='road_type')
a.sort_values(by = 'number of persons injured', ascending = False)
a = pivot_table(df_ksi, injured_killed= "killed", index='road_type')
a.sort_values(by = 'number of persons killed', ascending = False)
Plot_Injuries_vs_Year(df_ksi.loc[df_ksi['road_type'] == 'street'] , col='borough', hue='borough', injured_killed='injured')
Plot_Injuries_vs_Year(df_ksi.loc[df_ksi['road_type'] == 'others'] , col='borough', hue='borough', injured_killed='injured')
Plot_Injuries_vs_Year(df_ksi.loc[df_ksi['road_type'] == 'avenue'] , col='borough', hue='borough', injured_killed='injured')
Assumption 2: the reason for the spike in the 2016 compare to the previous years is because NYPD start implementing the digital reproting system. That is, it's faster and conveninent for the police and citizens to reprot, leading to dramatic increase in the number of reprots
Plot_Injuries_vs_Year(df_col, col=None, hue=None, injured_killed='injured')
Plot_Injuries_vs_Year(df_col, col=None, hue=None, injured_killed='killed')
Plot_Injuries_vs_Year(df_col, col='road_type', hue='road_type', injured_killed='injured')
pivot_table(df_col, injured_killed= "killed", index='borough')
pivot_table(df= df_col, injured_killed='injured', index='borough')
pivot_table(df= df_col, injured_killed='killed', index='year')
pivot_table(df= df_col, injured_killed='injured', index='year')
a = pivot_table(df= df_col, injured_killed='injured', index='road_type')
a.sort_values(by= 'number of persons injured', ascending = False)
a = pivot_table(df= df_col, injured_killed='killed', index='road_type')
a.sort_values(by= 'number of persons killed', ascending = False)
Plot_Injuries_vs_Year(df_col, col='borough', hue='borough', injured_killed='injured')
Plot_Injuries_vs_Year(df_col.loc[df_col['road_type'] == 'street'] , col='borough', hue='borough', injured_killed='injured')
Plot_Injuries_vs_Year(df_col.loc[df_col['road_type'] == 'others'] , col='borough', hue='borough', injured_killed='injured')
Plot_Injuries_vs_Year(df_col.loc[df_col['road_type'] == 'avenue'] , col='borough', hue='borough', injured_killed='injured')
test = df_col.loc[(df_col['number of persons killed'] > 0) & (df_col['number of persons injured'] > 0)]
Plot_Injuries_vs_Year(test, col='borough', hue='borough', injured_killed='injured')
Plot_Injuries_vs_Year(test, col='road_type', hue='road_type', injured_killed='injured')
Plot_Injuries_vs_Year(test, col='road_type', hue='road_type', injured_killed='killed')
Plot_Geoms_On_NYCMap(df_col.loc[df_col['road_type']=='expressway','location'].dropna(), ON_MAP=False)
Plot_Geoms_On_NYCMap(df_col.loc[df_col['road_type']=='parkway','location'].dropna(), ON_MAP=False)
Plot_Geoms_On_NYCMap(df_col.loc[df_col['road_type']=='bridge','location'].dropna(), ON_MAP=False)
Plot_Geoms_On_NYCMap(df_col.loc[df_col['road_type']=='drive','location'].dropna(), ON_MAP=False)
Plot_Geoms_On_NYCMap(df_col.loc[df_col['road_type'].apply(lambda x: x in ['expressway','parkway','bridge','drive']),'location'].dropna())
df_arterial = pd.read_csv("data/dot_VZV_Arterial_Slow_Zones_20190903.csv")
df_bike = pd.read_csv("data/dot_VZV_Bike_Priority_Districts_20190903.csv")
df_cross = pd.read_csv("data/dot_VZV_Enhanced_Crossings_20190903.csv")
df_left = pd.read_csv("data/dot_VZV_Left_Turn_Traffic_Calming_20190903.csv")
df_slow = pd.read_csv("data/dot_VZV_Neighborhood_Slow_Zones_20190903.csv")
df_signal = pd.read_csv("data/dot_VZV_Signal_Timing_20190903.csv")
df_spdhump = pd.read_csv("data/dot_VZV_Speed_Humps_20190903.csv")
df_spdlimit = pd.read_csv("data/dot_VZV_Speed_Limits_20190903.csv")
df_arterial['the_geom'] = df_arterial['the_geom'].apply(lambda x: shapely.wkt.loads(x))
df_bike['the_geom'] = df_bike['the_geom'].apply(lambda x: shapely.wkt.loads(x))
df_cross['the_geom'] = df_cross['the_geom'].apply(lambda x: shapely.wkt.loads(x))
df_left['the_geom'] = df_left['the_geom'].apply(lambda x: shapely.wkt.loads(x))
df_slow['the_geom'] = df_slow['the_geom'].apply(lambda x: shapely.wkt.loads(x))
df_signal['the_geom'] = df_signal['the_geom'].apply(lambda x: shapely.wkt.loads(x))
df_spdhump['the_geom'] = df_spdhump['the_geom'].apply(lambda x: shapely.wkt.loads(x))
df_spdlimit['the_geom'] = df_spdlimit['the_geom'].apply(lambda x: shapely.wkt.loads(x))
if False:
is_arterial, geoms_arterial = Is_Event_of_Geom(df_col, df_arterial, num_head = 100000000, THRESHOLD_DISTANCE = 0.0001)
pickle.dump([is_arterial, geoms_arterial], open('data/is_arterial.pickle', 'wb'))
# 10000 : 37 s
# total : 1h 22min 9s
else:
is_arterial, geoms_arterial = pickle.load(open('data/is_arterial.pickle', 'rb'))
if False:
is_bike, geoms_bike = Is_Event_of_Geom(df_col, df_bike, num_head = 100000000, THRESHOLD_DISTANCE = 0.0001)
pickle.dump([is_bike, geoms_bike], open('data/is_bike.pickle', 'wb'))
# 10000 : 11.6 s
# 100000 :
else:
is_bike, geoms_bike = pickle.load(open('data/is_bike.pickle', 'rb'))
if False:
is_cross, geoms_cross = Is_Event_of_Geom(df_col, df_cross, num_head = 100000000, THRESHOLD_DISTANCE = 0.0002)
pickle.dump([is_cross, geoms_cross], open('data/is_cross.pickle', 'wb'))
# 10000 : 1.61 s
# 100000 : 13.7 s
# total : 3min 45s
else:
is_cross, geoms_cross = pickle.load(open('data/is_cross.pickle', 'rb'))
if False:
is_left, geoms_left = Is_Event_of_Geom(df_col, df_left, num_head = 100000000, THRESHOLD_DISTANCE = 0.0002)
pickle.dump([is_left, geoms_left], open('data/is_left.pickle', 'wb'))
# 10000 : 2.63 s
# 100000 :
# total : 5min 37s
else:
is_left, geoms_left = pickle.load(open('data/is_left.pickle', 'rb'))
if False:
is_slow, geoms_slow = Is_Event_of_Geom(df_col, df_slow, num_head = 100000000, THRESHOLD_DISTANCE = 0.0001)
pickle.dump([is_slow, geoms_slow], open('data/is_slow.pickle', 'wb'))
# 10000 : 14.2 s
# total : 25min 41s
else:
is_slow, geoms_slow = pickle.load(open('data/is_slow.pickle', 'rb'))
if False:
is_signal, geoms_signal = Is_Event_of_Geom(df_col, df_signal, num_head = 100000000, THRESHOLD_DISTANCE = 0.0001)
pickle.dump([is_signal, geoms_signal], open('data/is_signal.pickle', 'wb'))
# 10000 : 22.1 s
# 100000 : 41min 28s
else:
is_signal, geoms_signal = pickle.load(open('data/is_signal.pickle', 'rb'))
if False:
is_spdhump, geoms_spdhump = Is_Event_of_Geom(df_col, df_spdhump, num_head = 100000000, THRESHOLD_DISTANCE = 0.0001)
pickle.dump([is_spdhump, geoms_spdhump], open('data/is_spdhump.pickle', 'wb'))
# 10000 : 14.6 s
# total: 39min 43s
else:
is_spdhump, geoms_spdhump = pickle.load(open('data/is_spdhump.pickle', 'rb'))
# if True:
# is_spdlimit, geoms_spdlimit = Is_Event_of_Geom(df_col, df_spdlimit, num_head = 100000000, THRESHOLD_DISTANCE = 0.0001)
# pickle.dump([is_spdlimit, geoms_spdlimit], open('is_spdlimit.pickle', 'wb'))
# # 100 : 7min 45s
# # 1000 : 9min 46s
# else:
# is_spdlimit, geoms_spdlimit = pickle.load(open('is_spdlimit.pickle', 'rb'))
df_col['is_arterial'] = is_arterial
df_col['is_bike'] = is_bike
df_col['is_cross'] = is_cross
df_col['is_left'] = is_left
df_col['is_slow'] = is_slow
df_col['is_signal'] = is_signal
df_col['is_spdhump'] = is_spdhump
# df_col['is_spdlimit'] = is_spdlimit
Plot_Geoms_On_NYCMap(df_arterial['the_geom'], ON_MAP=False)
Plot_Geoms_On_NYCMap(df_col.loc[df_col['is_arterial'],'location'].dropna(), ON_MAP=False)
Plot_Injuries_vs_Year(df_col, col='road_type', hue='is_arterial')
Plot_Geoms_On_NYCMap(df_bike['the_geom'], ON_MAP=False)
Plot_Geoms_On_NYCMap(df_col.loc[df_col['is_bike'],'location'].dropna(), ON_MAP=False)
Plot_Injuries_vs_Year(df_col, col='road_type', hue='is_bike')
Plot_Geoms_On_NYCMap(df_cross['the_geom'], ON_MAP=False)
Plot_Geoms_On_NYCMap(df_col.loc[df_col['is_cross'],'location'].dropna(), ON_MAP=False)
Plot_Injuries_vs_Year(df_col, col='road_type', hue='is_cross')
Plot_Geoms_On_NYCMap(df_left['the_geom'], ON_MAP=False)
Plot_Geoms_On_NYCMap(df_col.loc[df_col['is_left'],'location'].dropna(), ON_MAP=False)
Plot_Injuries_vs_Year(df_col, col='road_type', hue='is_left')
Plot_Geoms_On_NYCMap(df_slow['the_geom'], ON_MAP=False)
Plot_Geoms_On_NYCMap(df_col.loc[df_col['is_slow'],'location'].dropna(), ON_MAP=False)
Plot_Injuries_vs_Year(df_col, col='road_type', hue='is_slow')
Plot_Geoms_On_NYCMap(df_signal['the_geom'], ON_MAP=False)
Plot_Geoms_On_NYCMap(df_col.loc[df_col['is_signal'],'location'].dropna(), ON_MAP=False)
Plot_Injuries_vs_Year(df_col, col='road_type', hue='is_signal')
Plot_Geoms_On_NYCMap(df_spdhump['the_geom'], ON_MAP=False)
Plot_Geoms_On_NYCMap(df_col.loc[df_col['is_spdhump'],'location'].dropna(), ON_MAP=False)
Plot_Injuries_vs_Year(df_col, col='road_type', hue='is_spdhump')
# Plot_Geoms_On_NYCMap(df_spdlimit['the_geom'], ON_MAP=False)
# Plot_Injuries_vs_Year(df_col, col='road_type', hue='is_spdlimit')